package ai.restosuite.infrastructure.operation.listen;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.Expression;
import org.camunda.bpm.engine.delegate.JavaDelegate;

import java.util.Map;

/**
 * http调用，仅支持json
 */
public class HttpTaskListener implements JavaDelegate {

    private Expression httpUrl;

    private Expression httpMethod;
    @Override
    public void execute(DelegateExecution delegateExecution) throws Exception {
        //参数
        Map<String, Object> variables = delegateExecution.getVariables();
        //队列topic
        String url = (String) httpUrl.getValue(delegateExecution);

        String method = (String) httpMethod.getValue(delegateExecution);

        //发送http调用
        System.out.println("--------发送http调用 -------{url} :"+url + " {method} :"+ method + "{params} :"+variables);

    }
}
